Braces
Remove extra whitespace
* @param $table String
* @param $startId Integer or false
* @param $endId Integer or false
* @param $table String
* @param $startId Integer or false
* @param $endId Integer or false
+ * @return TitleArrayFromResult
*/
public function getLinks( $table, $startId = false, $endId = false ) {
wfProfileIn( __METHOD__ );
*/
public function getLinks( $table, $startId = false, $endId = false ) {
wfProfileIn( __METHOD__ );
$this->partitionCache[$table][$batchSize] = false;
$cacheEntry =& $this->partitionCache[$table][$batchSize];
$this->partitionCache[$table][$batchSize] = false;
$cacheEntry =& $this->partitionCache[$table][$batchSize];
// 2) try full result cache
if ( isset( $this->fullResultCache[$table] ) ) {
// 2) try full result cache
if ( isset( $this->fullResultCache[$table] ) ) {
return $cacheEntry['batches'];
}
return $cacheEntry['batches'];
}
// 3) ... fallback to memcached ...
global $wgMemc;
// 3) ... fallback to memcached ...
global $wgMemc;
/**
* Partition a DB result with backlinks in it into batches
/**
* Partition a DB result with backlinks in it into batches
- * @param $res database result
+ * @param $res ResultWrapper database result
* @param $batchSize integer
* @return array @see
*/
* @param $batchSize integer
* @return array @see
*/
* @param $caller String: the calling method
*/
public function doQuery( $users, $caller = '' ) {
* @param $caller String: the calling method
*/
public function doQuery( $users, $caller = '' ) {
- if ( count( $users ) === 0 ) return false;
+ if ( count( $users ) === 0 ) {
+ return false;
+ }
foreach ( (array) $users as $index => $value ) {
$users[$index] = strtr( $value, '_', ' ' );
foreach ( (array) $users as $index => $value ) {
$users[$index] = strtr( $value, '_', ' ' );
}
public function isFileCached() {
}
public function isFileCached() {
- if( $this->mType === false ) return false;
+ if( $this->mType === false ) {
+ return false;
+ }
return file_exists( $this->fileCacheName() );
}
return file_exists( $this->fileCacheName() );
}
*/
public static function useFileCache() {
global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang;
*/
public static function useFileCache() {
global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang;
- if( !$wgUseFileCache ) return false;
+ if( !$wgUseFileCache ) {
+ return false;
+ }
// Get all query values
$queryVals = $wgRequest->getValues();
foreach( $queryVals as $query => $val ) {
// Get all query values
$queryVals = $wgRequest->getValues();
foreach( $queryVals as $query => $val ) {
- if( $query == 'title' || $query == 'curid' ) continue;
+ if( $query == 'title' || $query == 'curid' ) {
+ continue;
+ }
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
- else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) continue;
- else if( $query == 'usemsgcache' && $val == 'yes' ) continue;
+ else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
+ continue;
+ } else if( $query == 'usemsgcache' && $val == 'yes' ) {
+ continue;
+ }
// Below are header setting params
// Below are header setting params
- else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' )
+ else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
}
// Check for non-standard user language; this covers uselang,
// and extensions for auto-detecting user language.
}
// Check for non-standard user language; this covers uselang,
// and extensions for auto-detecting user language.
public function isFileCacheGood( $timestamp = '' ) {
global $wgCacheEpoch;
public function isFileCacheGood( $timestamp = '' ) {
global $wgCacheEpoch;
- if( !$this->isFileCached() ) return false;
+ if( !$this->isFileCached() ) {
+ return false;
+ }
$cachetime = $this->fileCacheTime();
$good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime;
$cachetime = $this->fileCacheTime();
$good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime;
$apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : null;
if( is_array( $apacheHeaders ) ) {
// More reliable than $_SERVER due to case and -/_ folding
$apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : null;
if( is_array( $apacheHeaders ) ) {
// More reliable than $_SERVER due to case and -/_ folding
foreach ( $apacheHeaders as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
foreach ( $apacheHeaders as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
function wfGetAgent() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
function wfGetAgent() {
if( function_exists( 'apache_request_headers' ) ) {
// More reliable than $_SERVER due to case and -/_ folding
foreach ( apache_request_headers() as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
foreach ( apache_request_headers() as $tempName => $tempValue ) {
$set[ strtoupper( $tempName ) ] = $tempValue;
}
function wfIsTrustedProxy( $ip ) {
global $wgSquidServers, $wgSquidServersNoPurge;
function wfIsTrustedProxy( $ip ) {
global $wgSquidServers, $wgSquidServersNoPurge;
- if ( in_array( $ip, $wgSquidServers ) ||
- in_array( $ip, $wgSquidServersNoPurge )
- ) {
- $trusted = true;
- } else {
- $trusted = false;
- }
+ $trusted = in_array( $ip, $wgSquidServers ) ||
+ in_array( $ip, $wgSquidServersNoPurge );
wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
return $trusted;
}
wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
return $trusted;
}
* @param $res result A MySQL result including at least page_namespace and
* page_title -- also can have page_id, page_len, page_is_redirect,
* page_latest (if those will be used). See Title::newFromRow.
* @param $res result A MySQL result including at least page_namespace and
* page_title -- also can have page_id, page_len, page_is_redirect,
* page_latest (if those will be used). See Title::newFromRow.
+ * @return TitleArrayFromResult
*/
static function newFromResult( $res ) {
$array = null;
*/
static function newFromResult( $res ) {
$array = null;
+ /**
+ * @param $res
+ * @return TitleArrayFromResult
+ */
protected static function newFromResult_internal( $res ) {
$array = new TitleArrayFromResult( $res );
return $array;
protected static function newFromResult_internal( $res ) {
$array = new TitleArrayFromResult( $res );
return $array;
/**
* Split a filename into filename and extension
*
/**
* Split a filename into filename and extension
*
- * @param $filename Filename
+ * @param $filename string Filename
* @return array
*/
function splitFilename( $filename ) {
* @return array
*/
function splitFilename( $filename ) {